<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>a.html</title>
</head>
<script>
    let xhr = new XMLHttpRequest()
    xhr.open("get", "localhost:4000/apis", true)
    /* 2.前端发头 会发两次请求把条件判断 === “post”去掉*/
    xhr.setRequestHeader("name", "znc")
    xhr.send(null)
    xhr.onreadystatechange = () => {
        if (xhr.readyState == 4 && xhr.status == 200) {
            console.log(xhr.response)
            debugger
        }
    }
</script>

<body>

</body>

</html>